<template>
  <div class="house-container">
    <div class="house-info">
      <div class="info-card" v-for="house in houses" :key="house.id">
        <div class="card-status" :class="getStatusClass(house.status)">
          {{ getStatusText(house.status) }}
        </div>
        
        <div class="card-content">
          <div class="house-title">{{ house.name }}</div>
          
          <div class="info-item">
            <text class="label">地址</text>
            <text class="value">{{ house.address }}</text>
          </div>
          
          <div class="info-item">
            <text class="label">面积</text>
            <text class="value">{{ house.area }}㎡</text>
          </div>
          
          <div class="info-item">
            <text class="label">房型</text>
            <text class="value">{{ house.layout }}</text>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<style lang="scss" scoped>
.house-info {
  padding: 20rpx;
}

.info-card {
  background: #FFFFFF;
  border-radius: 12rpx;
  margin-bottom: 20rpx;
  position: relative;
  box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.08);
}

.card-status {
  position: absolute;
  right: 0;
  top: 0;
  padding: 6rpx 20rpx;
  border-radius: 0 12rpx 0 12rpx;
  font-size: 24rpx;
  
  &.status-rented {
    background: #E8F5E9;
    color: #4CAF50;
  }
  
  &.status-vacant {
    background: #FFF3E0;
    color: #FF9800;
  }
}

.card-content {
  padding: 30rpx;
}

.house-title {
  font-size: 32rpx;
  font-weight: bold;
  color: #333;
  margin-bottom: 20rpx;
}

.info-item {
  display: flex;
  margin-bottom: 16rpx;
  font-size: 28rpx;
  
  .label {
    color: #999;
    width: 80rpx;
    margin-right: 20rpx;
  }
  
  .value {
    color: #333;
    flex: 1;
  }
}
</style>

<script>
export default {
  data() {
    return {
      houses: [
        {
          id: 1,
          name: '2栋501',
          area: 89,
          layout: '两室一厅',
          status: 'rented' // rented: 已租, vacant: 空置
        }
      ]
    }
  },
  methods: {
    getStatusText(status) {
      return {
        rented: '已租',
        vacant: '空置',
      }[status] || '未知'
    },
    getStatusClass(status) {
      return {
        'status-rented': status === 'rented',
        'status-vacant': status === 'vacant'
      }
    }
  }
}
</script>
